const setLocalStroage = (key,value)=>{
    if(value instanceof Array || value instanceof Object){
        value = JSON.stringify(value)
    }
    localStorage.setItem(key,value)
}
const getLocalStroage = (key)=>{
    var value = localStorage.getItem(key)
    //^[\[{] 以[{开头 .*中间是一个或多个任意字符  [\]}]$ 以}]结尾   [选定内容]
    var reg = /^[\[{].*[\]}]$/;
    if(reg.test(value)){
        return JSON.parse(value)
    }else{
        return value
    }
}